﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace ConsultPoint.SharePoint.GoogleAnalyticsConnector.ControlTemplates
{
    public partial class GoogleAnalyticsConnector : UserControl
    {
        protected string AccountId
        {
            get
            {

                try
                {
                    string value = String.Empty;
                    SPWeb web = SPContext.Current.Web;


                    while (value == String.Empty || value == Helper.Constants.INHERITS)
                    {
                        if (web.Properties[Helper.Constants.KEY] != null)
                            value = web.Properties[Helper.Constants.KEY];

                        if (web.IsRootWeb)
                            break;
                        else
                            web = web.ParentWeb;
                    }


                    return value;
                }
                catch
                {
                    return String.Empty;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
        }
    }
}
